<div class="row">
    <div class="col-xs-12">
        <div class="box">

            <div class="box-body">
                <table id="brandList" class="table table-bordered table-hover">
                    <thead>
                    <tr>
                        <th>id</th>
                        <th>名称</th>
                        <th>图片</th>
                        <th>价格</th>
                        <th>品牌</th>
                        <th>wiki买过数</th>
                        <th>wiki收藏数</th>
                        <th>合并wiki</th>
                    </tr>
                    </thead>
                    <tbody>
                    <form action="{{url('admin/wiki/replaceWiki')}}" method="get">
                    <input type="hidden"  name="brandName" value="{{$brandName}}" class="form-control text" placeholder="" />
                    <input type="hidden"  name="wikiName" value="{{$wikiName}}" class="form-control text" placeholder="" />
                        @foreach($infos as $info)
                            <tr>
                                <input type="hidden" value="{{$info['id']}}" name="wiki_ids[]">
                                <td> {{$info['id']}} </td>
                                <td> {{$info['name']}} </td>
                                <td> <img style="height: 50px; width: 50px;" src="{{$info['thumb_cover_img']}} " class="img-thumbnail"> </td>
                                <td> {{$info['price']}} </td>
                                <td> @if($info['brand']) {{$info['brand']['name']}} @endif</td>
                                <td> {{$info['counter']['bought_num']}}</td>
                                <td> {{$info['counter']['fav_num']}}</td>
                                <td> <input type="radio" value="{{$info['id']}}" name="replace_wiki_id"></td>
                            </tr>
                        @endforeach
                        <div class="input-group">
                            <input type="submit" id="wiki_but" value="提交"  class="btn btn-primary start-scraper"/>
                        </div>
                    </form>
                    </tbody>
                </table>
            </div>

        </div>

        {{--<div class="input-group">--}}
        {{--<span class="input-group-addon"><i class="fa fa-pencil"></i></span>--}}
        {{--<form action="{{url('admin/wiki/replaceWiki')}}" method="get">--}}
        {{--@foreach($infos as $info)--}}
        {{--<input type="hidden" value="{{$info['id']}}" name="wiki_ids[]">--}}
        {{--@endforeach--}}
        {{--<input type="hidden" value="" id="replace_wiki_id" name="replace_wiki_id">--}}
        {{--<input style="width: 640px" type="text" id="wiki_info" name="icon" value="" class="form-control icon"  placeholder="" />--}}
        {{--<input type="submit" id="wiki_but" style="display: none;" class="btn btn-primary start-scraper"/>--}}
        {{--</form>--}}
        {{--</div>--}}



        {{--<div class="form-group  margin-sm display-inline">--}}
        {{--<label class="width-big">品牌</label>--}}
        {{--<select id="brand_id" class="select-width-large">--}}
        {{--<option value="-1">全部</option>--}}
        {{--</select>--}}
        {{--</div>--}}


    </div>
</div>

<script>
    $(function(){

        {{--main.zomeImg();--}}

        {{--main.allBrandList("{{url('/admin/brand/getAllBrand')}}", "270");--}}

        $('.icon').iconpicker();

        $('.icon').focus(function () {
            $('.iconpicker-popover').css({"width":"640px","left":"60px"});
            $('.iconpicker-items').empty();
        });

        $('.icon').trigger('focus');

        $('.icon').attr({"disabled" : "false"});

        $('.iconpicker-search').keyup(function () {
            var $key = $(this).val();
            $('.iconpicker').css({"overflow" : ""});

            if ($key != '') {

                $.get("{{url('admin/wiki/searchWiki')}}", {"key":$key}, function ($result) {
                    //alert($result.code);
                    if ($result.code) {
                        $list = $result.data.list;
                        $html = "<table id=\"brandList\" class=\"table table-bordered table-hover\">";
                        for (o in $list) {
                            $html = $html + "<tr class=\"wiki_data\" data-id = \"" + $list[o]['id'] + "\">";
                            $html = $html + "<td>" + $list[o]['id'] + "<\/td>";
                            $html = $html + "<td> <img style=\"height: 40px; width: 40px;\" src=\"" + $list[o]['thumb_cover_img']  + "\" class=\"img-thumbnail\"<\/img><\/td>";
                            $html = $html + "<td> " + $list[o]['name'] + "<\/td>";
                            $html = $html + "<td> " + $list[o]['price'] + " <\/td>";
                            $html = $html + "</tr>";
                        }

                        $html =  $html + "<\/table>";


                        //alert($html);

                        $('.iconpicker-items').html($html);

                    }

                    $('tr.wiki_data').click(function () {
                        var $id = $(this).attr('data-id');
                        var $name = $(this).find("td").eq(2).html();

                        $("#wiki_info").val( $id + " | " + $name);
                        $("#replace_wiki_id").val( $id );

                        $("#wiki_but").show();
                        $(".iconpicker-popover").hide();
                    });

                }, 'json');

            }
        });
    });


</script>